package com.cgbl.cg.ui

import android.content.pm.ActivityInfo
import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.cgbl.cg.BR
import com.cgbl.cg.R
import com.cgbl.cg.databinding.AppActivityVideoBinding
import com.cgbl.cg.databinding.AppActivityVideoBindingImpl
import com.cgbl.cg.vm.VideoViewModel
import com.robot.base.base.activity.GLBaseActivity
import com.robot.base.configs.AppConstants

@Route(path = AppConstants.Router.Main.A_VIDEO)
class VideoActivity : GLBaseActivity<AppActivityVideoBinding, VideoViewModel>() {

    override fun initContentView(savedInstanceState: Bundle?): Int = R.layout.app_activity_video

    override fun initVariableId(): Int = BR.viewModel
    val url =
        "https://cgon-oss.oss-cn-hangzhou.aliyuncs.com/224ffb3e99ef453b7ab3d03b0d2e7de011c5978fe7129b0e2332d81de2cdad65.mp4"

    override fun initComponents() {
        requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
        binding.surface.setDataPath(url)
    }

    override fun onPause() {
        super.onPause()
        binding.surface.pause()
    }

    override fun onDestroy() {
        super.onDestroy()
        binding.surface.destory()
    }
}